<template>
  <div id="box">
    <div class="title">
      <img
        src="/static/images/返回 (2).png"
        alt=""
      >
      <div>核销</div>
    </div>
    <div class="body">
      <div class="content1">
        <p>{{ service_data.shop_name }}</p>
        <div class="content1-1">
          <img
            :src="service_data.thumb"
            alt="img"
          >
          <div>
            <p>{{ service_data.name }}</p>
            <p>{{ service_data.brief }}</p>
            <p>￥{{ service_data.shop_price }}</p>
          </div>
        </div>
      </div>
      <div class="content2">
        <p>订单信息</p>
        <p>
          <span>订单号</span>
          <span>{{ order_data.order_sn }}</span>
        </p>
        <p>
          <span>下单时间</span>
          <span>{{ order_data.created_at }}</span>
        </p>
        <p>
          <span>预约时间</span>
          <span>{{ order_data.reserv_time }}</span>
        </p>
        <p>
          <span>付押金时间</span>
          <span>{{ order_data.pay_time }}</span>
        </p>
        <p>
          <span>付尾款时间</span>
          <span>{{ order_data.pay_left_time }}</span>
        </p>
      </div>
      <div class="content3">
        <p>买家信息</p>
        <div>
          <span>手机号</span>
          <span>{{ buyer_data.cellphone }}</span>
        </div>
      </div>
    </div>
    <div class="foot">
      <button @click="check">核 销</button>
    </div>
  </div>
</template>

<script>
export default {
  name: "hexiao",
  data () {
    return {
      buyer_data: '',
      order_data: '',
      service_data: '',
      // 第一步  定义
      ordersn: '',
      ordertype: '',
      member_user_token: '',
      servicessku: 'SKU8437'

    };
  },

  mounted () {
    this.token = localStorage.getItem('token');
    const params = {
      service_sku: '',
      order_sn: '',
    };
    this.$http
      .get('http://192.168.1.176:8087/api/v1/hexiao?service_sku=SKU8437&order_sn=MBO15634188732848562&user_token=9f502b3f365236d08ba5cc7f7d29f685', params, {
        headers: {
          user_token: this.token
        },

      }).then(res => {
        console.log('请求的后台数据是---', res)
        this.buyer_data = res.data.data.buyer_Data
        this.order_data = res.data.data.order_data
        this.service_data = res.data.data.service_data

        // 2 获取数据
        this.ordersn = res.data.data.order_data.order_sn
        this.ordertype = res.data.data.order_data.type
        this.member_user_token = res.data.data.buyer_Data.user_token

      })
  },

  methods: {
    // 点击提交内容
    check () {
      const params = {
        // 第三步
        ordersn: this.ordersn,
        ordertype: this.ordertype,
        member_user_token: this.member_user_token,
        servicessku: 'SKU8437'
      }
      console.log('1' + this.HOST + '/v1/order/dowriteoff')
      this.$http
        .post(this.HOST + '/v1/order/dowriteoff', params).then(function (res) {
          console.log(1111)
          console.log(params)
        })
    }
  }
}
      // 跳转到另一页面
      // this.$router.push('/home')

</script>

<style>
#box {
  background-color: #f6f6f6;
}
#box > .title {
  display: flex;
  padding: 10px 10px;
  font-size: 20px;
  margin-bottom: 2px;
  background-color: white;
  /* justify-content: center; */
  justify-content: space-between;
}
#box > .title > div {
  margin: 0 auto;
  font-size: 20px;
}
#box > .body {
  display: flex;
  flex-flow: column;
  font-size: 18px;
}
#box > .body > .content1,
.content2 {
  background-color: white;
  margin-bottom: 4px;
  padding: 10px 10px;
}
#box > .body > .content3 {
  background-color: white;
  padding: 10px 10px;
}
#box > .body > .content1 > p {
  font-size: 16px;
  color: #999999;
  margin-bottom: 10px;
}
#box > .body > .content1 > .content1-1 {
  display: flex;
  flex-grow: inherit;
}
#box > .body > .content1 > .content1-1 > div > p:nth-child(2) {
  font-size: 12px;
  color: #9e9e9e;
  height: 35px;
  margin-top: 5px;
}
#box > .body > .content1 > .content1-1 > div > p:nth-child(3) {
  color: #ff954f;
  font-size: 18px;
}
#box > .body > .content1 > .content1-1 > img {
  margin-right: 10px;
}
#box > .body > .content2 {
  display: flex;
  flex-flow: inherit;
}
#box > .body > .content2 > p {
  margin-bottom: 7px;
}
#box > .body > .content2 > p:last-child {
  margin-bottom: 0;
}
#box > .body > .content2 p span:first-child {
  float: left;
}
#box > .body > .content2 p span:last-child {
  float: right;
}
#box > .body > .content3 {
  margin-bottom: 100%;
}
#box > .body > .content3 > p,
#box > .body > .content2 > p:first-child {
  font-size: 0.9em;
  color: #999999;
}
#box > .body > .content3 > div {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 0 0;
}
#box > .foot {
  height: 100%;
}
#box > .foot > button {
  width: 100%;
  height: 50px;
  font-size: 16px;
  border: none;
  background-color: #f8c301;
  padding: 10px auto;
  position: absolute;
  bottom: 0px;
}
</style>
